package com.example.springboot.mqtt.serivice.impl;

import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import com.baidu.aip.http.Headers;
import com.example.springboot.mqtt.entity.CashVip;
import com.example.springboot.mqtt.mapper.CashVipMapper;
import com.example.springboot.mqtt.serivice.ICashVibService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class CashVibServiceImpl implements ICashVibService {
    @Autowired
    private CashVipMapper cashVipMapper;
    @Override
    public String getCashVib(String account, String password) {
        String body = null;
        try {
            String url = "http://localhost:7001/?email="+account+"&password="+password;
            System.out.println(url);
            body = HttpRequest.get(url)
                    .header(Headers.USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36")
                    .header("X-Requested-With", "XMLHttpRequest")
                    .header(Header.COOKIE, "BIDUPSID=457C3455302D430C9674CAC89AF78CFA; PSTM=1657781295; BAIDUID=CE87CE2967A79BC2C0617B8BA1AC45B3:SL=0:NR=10:FG=1; BD_UPN=12314753; MCITY=-176%3A; H_WISE_SIDS_BFESS=234020_216839_213354_214792_110085_244727_259031_261710_236312_256419_265881_266354_265615_267074_268405_268593_266186_259642_269232_269783_268236_269905_267066_256739_270460_270519_270603_270547_271019_271173_256958_267659_271319_270102_271879_269857_271813_271935_234296_234208_269296_272082_272226_270055_272279_267596_272336_253022_272653_272836_260335_272986_273061_267558_273160_273164_273138_273215_273263_273238_273301_273400_273392_271158_273455_273473_273519_271562_271146_273703_273318_264170_272262_263619_274082_273931_273965_274142_269610_273918_273044_273598_272695_272859_256223_272562_274426_274441_188333_274649_274765_274759_274822_274839_274844_274856_274847_270158_274870_273981_275070_272801_274452_267807_267547_275145_272333_275167_275197_275147_272318_8000051_8000108_8000124_8000142_8000160_8000162_8000165_8000170_8000183_8000186_8000204; sug=3; sugstore=0; ORIGIN=0; bdime=0; ispeed_lsm=2; H_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L3HJOmMJjE5bcHMhoK--Q0KKJyLR-8Kb7VbPjoMUnkbfJBDGOUQbjkK56e2JRkQIbvennJhf6AXx47yajK2boGQG58-UbuQtoFDqrP0UjpQT8ryJ_OK5OiJgDqslnNab3vOPTNXpO15jkzBN5thURB2DkO-4bCWJ5TMl5jDh3Mb6ksDMDtqj0OtbkO_Ktyf-3bfTrx5tQHMDCShGRHafo9WDTm_D_5H4JdjKQl0nJcKh33yP6zK-o30K6Z-pPKKR70sPjoht6obj8VMnrrBJcB3mkjbpQGfn02OP5EQUrcW44syPR8KxRnWTIOKfA-b4ncjRcTehoM3xI8LNj405OTbIFO0KJyJCFhhKPGD6uMD5PfbeTXatb8-bCX3buQQh4V8pcNLTDK5fAq5UAtblJM-n6n_pvFytQaDt5kjlO1j4_eKpOg0fbhyTQJ-l4aytOzSh5jDh3PXjksD-RlanJtKeoy0hvcMR5cShnGeMjrDRLbXU6BK5vPbNcZ0l8K3l02V-bIe-t225QhDG-DJTkjJR-s_C8atTrWeIbcbtI_-P4DePO73xRZ5mAqoqOHKfT4V4jKyU5J350UyR6MBMne-C7naIQqah0WVhOTbMjsqj53XqbNWJO43bRTW-Py5KJvfJopKUTChP-Uypr-Wh37bRblMKoaMp78jR093JO4y4Ldj4oxJpOJ5JbMonLafDKahK-ljjK-eP0OqxJO243fHD7XVK5aWl7keq8CD4c2b4PVylQpXtbXQm6w_R3RBJ3IDPQ2y5jHhnIXytRaal58BbnRoqRK2lRpsIJMQxFWbT8UQx79KPkeaKvia-THBMb1fDnDBT5h2M4qMxtOLR3pWDTm_q5TtUJMeCnTDbAhe4tX-NFJJ5KtJx5; H_PS_645EC=2e7cTUbugOqhTVjLNzr5%2FDiuawzqN3FtHO%2Bk%2BIlcJWq46kZzYLKgFusysCA; COOKIE_SESSION=171_1_7_7_8_24_1_0_6_7_1_7_591_0_0_0_1700736994_1700706226_1700737162%7C9%23175549_11_1700706222%7C9; WWW_ST=1700737266076")
                    .execute().body();
        }catch (Exception e){
            e.printStackTrace();
        }
        return body;
    }

    @Override
    public CashVip getAccount() {
        return cashVipMapper.getAccount();
    }

    @Override
    public boolean updateAccount(String username, String  v, String v1) {
        return cashVipMapper.updateAccount(username,v,v1)==1;
    }

}
